import csv
# 读取文件内容
# with open('data.csv', mode='r', encoding='utf8') as file:
#     cf = csv.reader(file)
#     head = next(cf)  # 获取表头
#     scores = []
#     for i in cf:
#         scores.append(int(i[-1]))
#     print('平均分为 ：%.2f' %(sum(scores) / len(scores)))

# 写入文件内容
with open('data.csv', mode='a', encoding='utf8') as file:
    cf = csv.writer(file)
    cf.writerow(['akka', 'C++', 90])
    data = [['tt', 'python', 29], ['pety', 'C', 67]]
    cf.writerows(data)